package com.minshenglife.zanzan.service.impl;

import java.awt.Color;
import java.awt.Font;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.servlet.ServletUtilities;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.TextAnchor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.minshenglife.commons.dal.Page;
import com.minshenglife.zanzan.dao.ManagerDao;
import com.minshenglife.zanzan.dao.UserDao;
import com.minshenglife.zanzan.entity.ComplainCount;
import com.minshenglife.zanzan.entity.Dept;
import com.minshenglife.zanzan.entity.DeptCount;
import com.minshenglife.zanzan.entity.ManagerMail;
import com.minshenglife.zanzan.entity.ReviewCount;
import com.minshenglife.zanzan.entity.User;
import com.minshenglife.zanzan.entity.UserLog;
import com.minshenglife.zanzan.entity.WorkLogCount;
import com.minshenglife.zanzan.entity.WorkLogCountWeek;
import com.minshenglife.zanzan.pub.CalcUtils;
import com.minshenglife.zanzan.result.EmpWorkCon;
import com.minshenglife.zanzan.result.ManagerResult;
import com.minshenglife.zanzan.result.WorkConReview;
import com.minshenglife.zanzan.service.manage.ManagerService;

/**
 * @author Hao HaiLin
 *
 */
@Component
@Transactional
public class ManagerServiceImpl implements ManagerService{
	/* (non-Javadoc)
	 * @see com.minshenglife.zanzan.service.manage.ManagerService#countAll(java.util.Map, int, int)
	 */
	@Resource
	private ManagerDao managerDao;
	@Resource
	private UserDao userDao;
	
	@Override
	@Transactional(readOnly=true)
	public Page<User> countAll(Map<String,Object> map,int pageNo,int pageSize){
		Page<User> ret = new Page<User>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<User> rows = managerDao.findByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public List<DeptCount> countByDept(Map<String,Object> map){
		List<DeptCount> list = managerDao.countByDept(map);
		return list;
	}
	@Override
	public String getImageUrl(List<DeptCount> deptCountList,HttpSession session,HttpServletRequest request ){
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		for(int i=0;i<deptCountList.size();i++){
			DeptCount deptCount = deptCountList.get(i);
			if(deptCount.getDeptName() == null){
				deptCount.setDept("管理员");
				deptCount.setDeptName("管理员");
				deptCount.setSumIntegral(0);
				deptCount.setSumRedFlower(0);
				deptCount.setSumSendFlower(0);
			}
			dataset.addValue(deptCount.getSumRedFlower(), "红花数", deptCount.getDeptName());
			dataset.addValue(deptCount.getSumSendFlower(), "送花数", deptCount.getDeptName());
			dataset.addValue(deptCount.getSumIntegral(), "积分数", deptCount.getDeptName());	
		}

		//创建主题样式  
	       StandardChartTheme standardChartTheme=new StandardChartTheme("CN");  
	       //设置标题字体  
	       standardChartTheme.setExtraLargeFont(new Font("SimSun",Font.BOLD,20));  
	       //设置图例的字体  
	       standardChartTheme.setRegularFont(new Font("SimSun",Font.PLAIN,15));  
	       //设置轴向的字体  
	       standardChartTheme.setLargeFont(new Font("SimSun",Font.PLAIN,15));  
	       //应用主题样式  
	       ChartFactory.setChartTheme(standardChartTheme);
		JFreeChart chart=ChartFactory.createBarChart3D("部门红花、送花、积分统计图", "部门", "数量", dataset, PlotOrientation.VERTICAL, true, true, true);



		CategoryPlot plot = chart.getCategoryPlot(); 
		//设置网格背景颜色
		plot.setBackgroundPaint(Color.white);
		//设置网格竖线颜色
		plot.setDomainGridlinePaint(Color.pink);
		//设置网格横线颜色
		plot.setRangeGridlinePaint(Color.pink);
		//显示每个柱的数值，并修改该数值的字体属性
		BarRenderer3D renderer = new BarRenderer3D();
		renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
		renderer.setBaseItemLabelsVisible(true);
		//默认的数字显示在柱子中，通过如下两句可调整数字的显示
		//注意：此句很关键，若无此句，那数字的显示会被覆盖，给人数字没有显示出来的问题
		renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
		renderer.setItemLabelAnchorOffset(10D);
		//设置每个地区所包含的平行柱的之间距离
		renderer.setItemMargin(0.1);
		plot.setRenderer(renderer);
		//将默认放在左边的“数量”放到右方
		String filename = "";
		try {
			filename = ServletUtilities.saveChartAsPNG(chart, 500, 300, null, session);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String graphURL = request.getContextPath() + "/DisplayChart?filename=" + filename;
		return graphURL;	
	}
	@Override
	public void getExcel(Map<String,Object> map,List<User> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				cell.setCellValue("序号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				if((Integer)map.get("countFlag")==0){
					cell = row.createCell(5);
					cell.setCellValue("红花数");
					cell.setCellStyle(style);
					cell = row.createCell(6);
					cell.setCellValue("送花数");
					cell.setCellStyle(style);
					cell = row.createCell(7);
					cell.setCellValue("积分");
					cell.setCellStyle(style);
				}
				if((Integer)map.get("countFlag")==1){
					cell = row.createCell(5);
					cell.setCellValue("红花数"); 
					cell.setCellStyle(style);
				}
				if((Integer)map.get("countFlag")==2){
					cell = row.createCell(5); 
					cell.setCellValue("送花数");
					cell.setCellStyle(style); 	
				}
				if((Integer)map.get("countFlag")==3){
					cell = row.createCell(5);
					cell.setCellValue("积分");
					cell.setCellStyle(style);
				}

				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					User user =  userList.get(i);
					if(user.getRedFlowerNum() == null){
						user.setRedFlowerNum(0d);
					}
					if(user.getIntegralNum() == null){
						user.setIntegralNum(0l);
					}
					if(user.getSendFlowerNum() == null){
						user.setSendFlowerNum(0l);
					}
					// 第四步，创建单元格，并设置值
					row.createCell(0).setCellValue(user.getIdNo());
					row.createCell(1).setCellValue(user.getEmpId());
					row.createCell(2).setCellValue(user.getEmp_name());
					if("F".equals(user.getSex())){
						user.setSex("女");
					}else if("M".equals(user.getSex())){
						user.setSex("男");
					}
					row.createCell(3).setCellValue(user.getSex());
					row.createCell(4).setCellValue(user.getDeptName());
					if((Integer)map.get("countFlag")==0){
						row.createCell(5).setCellValue(user.getRedFlowerNum());
						row.createCell(6).setCellValue(user.getSendFlowerNum());
						row.createCell(7).setCellValue(user.getIntegralNum());
					}
					if((Integer)map.get("countFlag")==1){
						row.createCell(5).setCellValue(user.getRedFlowerNum());
				
					}
					if((Integer)map.get("countFlag")==2){
						
						row.createCell(5).setCellValue(user.getSendFlowerNum());
					}
					if((Integer)map.get("countFlag")==3){
						row.createCell(5).setCellValue(user.getIntegralNum());
					}
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	@Transactional(readOnly=true)
	public List<User> countForExcel(Map<String,Object> map){
		List<User> list = managerDao.findForExcel(map);
		return list;
	}
	@Override
	@Transactional(readOnly=true)
	public Page<UserLog> countForLog(Map<String,Object> map,int pageNo,int pageSize){
		Page<UserLog> ret = new Page<UserLog>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countLogByConditions(map);
		System.out.println("***************");
		System.out.println(offset);
		System.out.println(offset+pageSize);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<UserLog> rows = managerDao.findLogByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;	
	}
	@Override
	@Transactional(readOnly=true)
	public List<Dept> findDept(){
		List<Dept> list = managerDao.findAllDept();
		return list;
	}
	
	@Override
	@Transactional(readOnly=true)
	public List<User> getUser(String userName,String password) {
		User user=new User();
		user.setEmpId(userName);
		user.setPassword(password);
		return userDao.findByExample(user);
		
	}
	@Override
	@Transactional(readOnly=true)
	public Page<User> countRed(Map<String,Object> map,int pageNo,int pageSize){
		Page<User> ret = new Page<User>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countRedByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<User> rows = managerDao.findRedByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public List<User> countRedForExcel(Map<String,Object> map){
		List<User> list = managerDao.findRedForExcel(map);
		return list;
	}
	@Override
	public void getRedExcel(Map<String,Object> map,List<User> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				cell.setCellValue("序号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				cell = row.createCell(5);
				cell.setCellValue("红花数"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					User user =  userList.get(i);
					// 第四步，创建单元格，并设置值
					row.createCell(0).setCellValue(user.getIdNo());
					row.createCell(1).setCellValue(user.getEmpId());
					row.createCell(2).setCellValue(user.getEmp_name());
					if("F".equals(user.getSex())){
						user.setSex("女");
					}else if("M".equals(user.getSex())){
						user.setSex("男");
					}
					row.createCell(3).setCellValue(user.getSex());
					row.createCell(4).setCellValue(user.getDeptName());
					row.createCell(5).setCellValue(user.getRedFlowerNum());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	@Transactional(readOnly=true)
	public Page<User> countSend(Map<String,Object> map,int pageNo,int pageSize){
		Page<User> ret = new Page<User>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countSendByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<User> rows = managerDao.findSendByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public List<User> countSendForExcel(Map<String,Object> map){
		List<User> list = managerDao.findSendForExcel(map);
		return list;
	}
	@Override
	public void getSendExcel(Map<String,Object> map,List<User> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				cell.setCellValue("序号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				cell = row.createCell(5);
				cell.setCellValue("送花数"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					User user =  userList.get(i);
					// 第四步，创建单元格，并设置值
					
					row.createCell(0).setCellValue(user.getIdNo());
					row.createCell(1).setCellValue(user.getEmpId());
					row.createCell(2).setCellValue(user.getEmp_name());
					if("F".equals(user.getSex())){
						user.setSex("女");
					}else if("M".equals(user.getSex())){
						user.setSex("男");
					}
					row.createCell(3).setCellValue(user.getSex());
					row.createCell(4).setCellValue(user.getDeptName());
					row.createCell(5).setCellValue(user.getSendFlowerNum());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	@Transactional(readOnly=true)
	public Page<User> countIntegral(Map<String,Object> map,int pageNo,int pageSize){
		Page<User> ret = new Page<User>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countIntegralByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<User> rows = managerDao.findIntegralByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public List<User> countIntegralForExcel(Map<String,Object> map){
		List<User> list = managerDao.findIntegralForExcel(map);
		return list;
	}
	@Override
	public void getIntegralExcel(Map<String,Object> map,List<User> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				cell.setCellValue("序号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				cell = row.createCell(5);
				cell.setCellValue("积分"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					User user =  userList.get(i);
					// 第四步，创建单元格，并设置值
					row.createCell(0).setCellValue(user.getIdNo());
					row.createCell(1).setCellValue(user.getEmpId());
					row.createCell(2).setCellValue(user.getEmp_name());
					if("F".equals(user.getSex())){
						user.setSex("女");
					}else if("M".equals(user.getSex())){
						user.setSex("男");
					}
					row.createCell(3).setCellValue(user.getSex());
					row.createCell(4).setCellValue(user.getDeptName());
					row.createCell(5).setCellValue(user.getIntegralNum());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	public Page<ManagerResult> findProgressRank(Map<String,Object> map,int pageNo,int pageSize){
		if(map==null)
			map=new HashMap<String,Object>();
		int offset = (pageNo-1) * pageSize;
        map.put("from", offset);
        map.put("to", offset+pageSize);
        //设置查询的时间范围
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        Calendar c=Calendar.getInstance();
        map.put("today", sdf.format(c.getTime()));
        c.add(Calendar.DAY_OF_MONTH, -1);
        map.put("beforeDay", sdf.format(c.getTime()));
        
        Long count =managerDao.countFlowerProgressBank(map);
        List<ManagerResult> rows =managerDao.findFlowerProgressBank(map);
        Page<ManagerResult> ret = new Page<ManagerResult>();
        ret.setRows(rows);
        ret.setTotalRow(count);
        ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
        ret.setPageSize(pageSize);
        ret.setPageNo(pageNo);
        return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public List<ManagerResult> countProgressForExcel(Map<String,Object> map){
		//设置查询的时间范围
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        Calendar c=Calendar.getInstance();
        map.put("today", sdf.format(c.getTime()));
        c.add(Calendar.DAY_OF_MONTH, -1);
        map.put("beforeDay", sdf.format(c.getTime()));
		List<ManagerResult> list = managerDao.findProgressForExcel(map);
		return list;
	}
	@Override
	public void getProgressExcel(Map<String,Object> map,List<ManagerResult> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("进步名次"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					ManagerResult managerResult =  userList.get(i);
					// 第四步，创建单元格，并设置值
					row.createCell(0).setCellValue(managerResult.getEmpId());
					row.createCell(1).setCellValue(managerResult.getEmpName());
					if("F".equals(managerResult.getSex())){
						managerResult.setSex("女");
					}else if("M".equals(managerResult.getSex())){
						managerResult.setSex("男");
					}
					row.createCell(2).setCellValue(managerResult.getSex());
					row.createCell(3).setCellValue(managerResult.getDeptName());
					row.createCell(4).setCellValue(managerResult.getRanking());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	public Page<ManagerMail> findMail(Map<String,Object> map,int pageNo,int pageSize){
		Page<ManagerMail> ret = new Page<ManagerMail>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countMailByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<ManagerMail> rows = managerDao.findMailByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	public ManagerMail findMailContent(Map<String,Object> map){
		ManagerMail managerMailContent = managerDao.findMailContent(map);
		return managerMailContent;
	}
	@Override
	public Page<ReviewCount> countReview(Map<String,Object> map,int pageNo,int pageSize){
		Page<ReviewCount> ret = new Page<ReviewCount>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countReviewConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<ReviewCount> rows = managerDao.findReviewByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	public Page<ComplainCount> countComplain(Map<String,Object> map,int pageNo,int pageSize){
		Page<ComplainCount> ret = new Page<ComplainCount>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countComplainConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<ComplainCount> rows = managerDao.findComplainByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	public Page<WorkLogCount> countWorkLog(Map<String,Object> map,int pageNo,int pageSize){
		Page<WorkLogCount> ret = new Page<WorkLogCount>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countWorkLogByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<WorkLogCount> rows = managerDao.findWorkLogByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	/*@Override
	public Page<WorkLogCount> countBWorkLog(Map<String,Object> map,int pageNo,int pageSize){
		Page<WorkLogCount> ret = new Page<WorkLogCount>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countWorkLogByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<WorkLogCount> rows = managerDao.findBWorkLogByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}*/
	
	@Override
	public Page<WorkLogCount> countWorkLogBySHY(Map<String,Object> map,int pageNo,int pageSize){
		Page<WorkLogCount> ret = new Page<WorkLogCount>();
//		int offset = (pageNo-1)*pageSize;
//		Long count = managerDao.countWorkLogByConditionsBySHY(map);
//		map.put("from", offset);
//		map.put("to", offset+pageSize);
//		List<WorkLogCount> rows = managerDao.findWorkLogByConditons(map);
//		ret.setPageNo(pageNo);
//		ret.setPageSize(pageSize);
//		ret.setRows(rows);
//		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
//		ret.setTotalRow(count);
		return ret;
	}
	
	@Override
	@Transactional(readOnly=true)
	public List<WorkLogCount> countWorkLogForExcel(Map<String,Object> map){
		List<WorkLogCount> list = managerDao.findWorkLogForExcel(map);
		return list;
	}
	@Override
	public void getWorkLogExcel(Map<String,Object> map,List<WorkLogCount> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				cell.setCellValue("部门及科室");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("工作内容");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("是否填写");
				cell.setCellStyle(style);
				cell = row.createCell(5);
				cell.setCellValue("创建时间");
				cell.setCellStyle(style);
				cell = row.createCell(6);
				cell.setCellValue("审阅状态"); 
				cell.setCellStyle(style);
				cell = row.createCell(7);
				cell.setCellValue("审阅人"); 
				cell.setCellStyle(style);
				
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					 WorkLogCount workLog =  userList.get(i);
					// 第四步，创建单元格，并设置值
					String iswright ="";
					if(workLog.getWorkCon()!=null&&!workLog.getWorkCon().equals("")){
						iswright ="√";
					}
					row.createCell(0).setCellValue(workLog.getDeptName());
					row.createCell(1).setCellValue(workLog.getEmpId());
					row.createCell(2).setCellValue(workLog.getEmpName());
					row.createCell(3).setCellValue(workLog.getWorkCon());
					row.createCell(4).setCellValue(iswright);
					row.createCell(5).setCellValue(workLog.getCreate_time());
					row.createCell(6).setCellValue(workLog.getReviewState());
					row.createCell(7).setCellValue(workLog.getReviewmpId());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	@Transactional(readOnly=true)
	public Page<User> countDeptSum(Map<String,Object> map,int pageNo,int pageSize){
		Page<User> ret = new Page<User>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countDeptSumByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<User> rows = managerDao.findDeptSumByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public Page<User> countDeptSendSum(Map<String,Object> map,int pageNo,int pageSize){
		Page<User> ret = new Page<User>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countDeptSendSumByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<User> rows = managerDao.findDeptSendSumByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	@Transactional(readOnly=true)
	public List<User> countDeptRedForExcel(Map<String,Object> map){
		List<User> list = managerDao.findDeptRedForExcel(map);
		return list;
	}
	@Override
	public void getDeptRedExcel(Map<String,Object> map,List<User> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("民生保险微家统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				/*cell.setCellValue("序号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(4);*/
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("红花数"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					User user =  userList.get(i);
					// 第四步，创建单元格，并设置值
					
					/*row.createCell(0).setCellValue(user.getIdNo());
					row.createCell(1).setCellValue(user.getEmpId());
					row.createCell(2).setCellValue(user.getEmp_name());
					if("F".equals(user.getSex())){
						user.setSex("女");
					}else if("M".equals(user.getSex())){
						user.setSex("男");
					}
					row.createCell(3).setCellValue(user.getSex());*/
					row.createCell(0).setCellValue(user.getDeptName());
					row.createCell(1).setCellValue(user.getRedFlowerNum());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	@Transactional(readOnly=true)
	public List<User> countDeptSendForExcel(Map<String,Object> map){
		List<User> list = managerDao.findDeptSendForExcel(map);
		return list;
	}
	@Override
	public void getDeptSendExcel(Map<String,Object> map,List<User> userList,OutputStream out){
		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("民生保险微家统计表");
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

				HSSFCell cell = row.createCell(0);
				/*cell.setCellValue("序号");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("性别");
				cell.setCellStyle(style);
				cell = row.createCell(4);*/
				cell.setCellValue("部门");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("送花数"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					User user =  userList.get(i);
					// 第四步，创建单元格，并设置值
					
					/*row.createCell(0).setCellValue(user.getIdNo());
					row.createCell(1).setCellValue(user.getEmpId());
					row.createCell(2).setCellValue(user.getEmp_name());
					if("F".equals(user.getSex())){
						user.setSex("女");
					}else if("M".equals(user.getSex())){
						user.setSex("男");
					}
					row.createCell(3).setCellValue(user.getSex());*/
					row.createCell(0).setCellValue(user.getDeptName());
					row.createCell(1).setCellValue(user.getSendFlowerNum());
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
	@Override
	public List<WorkLogCount> countWorkLogBySHYForExcel(Map<String, Object> map) {
		List<WorkLogCount> list = managerDao.findSHYWorkLogByLogDateForExcel(map);
		return list;
	}
	@Override
	public Page<WorkLogCount> countBWorkLog(Map<String, Object> map,
			int pageNo, int pageSize) {
		Page<WorkLogCount> ret = new Page<WorkLogCount>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countBWorkLogByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<WorkLogCount> rows = managerDao.findBWorkLogByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	public List<WorkLogCount> countBWorkLogBySHYForExcel(Map<String, Object> map) {
		List<WorkLogCount> list = managerDao.findBWorkLogByConditonsForExcel(map);
		return list;
	}
	
	@Override
	public Page<WorkLogCountWeek> countBWeekWorkLog(Map<String, Object> map,
			int pageNo, int pageSize) {
		Page<WorkLogCountWeek> ret = new Page<WorkLogCountWeek>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countBWorkLogWeekByConditions(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<WorkLogCountWeek> rows = managerDao.findBWeekWorkCountByConditons(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	@Override
	public List<WorkLogCountWeek> countBWorkLogByWeekForExcel(
			Map<String, Object> map) {
		List<WorkLogCountWeek> list = managerDao.findBWeekWorkCountByConditonsForExcel(map);
		return list;
	}
	@Override
	public void getWorkLogWeekExcel(Map<String, Object> map,
			List<WorkLogCountWeek> userList, OutputStream out) {
		// 第一步，创建一个webbook，对应一个Excel文件
		HSSFWorkbook wb = new HSSFWorkbook();
		// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
		HSSFSheet sheet = wb.createSheet("赞赞民生人周统计表");
		// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
		HSSFRow row = sheet.createRow((int) 0);
		// 第四步，创建单元格，并设置值表头 设置表头居中
		HSSFCellStyle style = wb.createCellStyle();
		style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式

		HSSFCell cell = row.createCell(0);
		cell.setCellValue("部门及科室");
		cell.setCellStyle(style);
		cell = row.createCell(1);
		cell.setCellValue("工号");
		cell.setCellStyle(style);
		cell = row.createCell(2);
		cell.setCellValue("姓名");
		cell.setCellStyle(style);
		cell = row.createCell(3);
		cell.setCellValue(map.get("weekday0")+"");
		cell.setCellStyle(style);
		cell = row.createCell(4);
		cell.setCellValue(map.get("weekday1")+"");
		cell.setCellStyle(style);
		cell = row.createCell(5);
		cell.setCellValue(map.get("weekday2")+"");
		cell.setCellStyle(style);
		cell = row.createCell(6);
		cell.setCellValue(map.get("weekday3")+""); 
		cell.setCellStyle(style);
		cell = row.createCell(7);
		cell.setCellValue(map.get("weekday4")+""); 
		cell.setCellStyle(style);
		cell = row.createCell(8);
		cell.setCellValue(map.get("weekday5")+"");
		cell.setCellStyle(style);
		cell = row.createCell(9);
		cell.setCellValue(map.get("weekday6")+""); 
		cell.setCellStyle(style);
		cell = row.createCell(10);
		cell.setCellValue("填写次数合计"); 
		cell.setCellStyle(style);
		
		// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
		for (int i = 0; i < userList.size(); i++)
		{
			row = sheet.createRow((int) i + 1);
			WorkLogCountWeek workLog =  userList.get(i);
			// 第四步，创建单元格，并设置值			
			row.createCell(0).setCellValue(workLog.getDeptName());
			row.createCell(1).setCellValue(workLog.getEmpId());
			row.createCell(2).setCellValue(workLog.getEmpName());
			row.createCell(3).setCellValue(workLog.getWeekday0());
			row.createCell(4).setCellValue(workLog.getWeekday1());
			row.createCell(5).setCellValue(workLog.getWeekday2());
			row.createCell(6).setCellValue(workLog.getWeekday3());
			row.createCell(7).setCellValue(workLog.getWeekday4());
			row.createCell(8).setCellValue(workLog.getWeekday5());
			row.createCell(9).setCellValue(workLog.getWeekday6());
			row.createCell(10).setCellValue(workLog.getCount());
		}
		// 第六步，将文件存到指定位置
		try
		{
			wb.write(out);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		
	}
	
	@Override
	public Page<WorkLogCountWeek> countBWeekWorkLogNoSoft(Map<String, Object> map,
			int pageNo, int pageSize) {
		Page<WorkLogCountWeek> ret = new Page<WorkLogCountWeek>();
		int offset = (pageNo-1)*pageSize;
		Long count = managerDao.countBWorkLogWeekByConditionsNoSoft(map);
		map.put("from", offset);
		map.put("to", offset+pageSize);
		List<WorkLogCountWeek> rows = managerDao.findBWeekWorkCountByConditonsNoSoft(map);
		ret.setPageNo(pageNo);
		ret.setPageSize(pageSize);
		ret.setRows(rows);
		ret.setTotalPage(CalcUtils.calcTotalPage(pageSize, count));
		ret.setTotalRow(count);
		return ret;
	}
	
	@Override
	public List<WorkLogCountWeek> countBWorkLogByWeekForExcelNoSoft(
			Map<String, Object> map) {
		List<WorkLogCountWeek> list = managerDao.findBWeekWorkCountByConditonsForExcelNoSoft(map);
		return list;
	}
	@Override
	public List<EmpWorkCon> selectWorkConAndReviews(Map<String, Object> map) {
		List<EmpWorkCon> list = null;
		try{
			list = managerDao.selectWorkConAndReviews(map);
		}catch(Exception ex){
			ex.printStackTrace();
			return null;
		}
		return list;
	}
	@Override
	public void getWorkLogExcel4(Map<String, Object> map,
			List<EmpWorkCon> userList, OutputStream out) {

		//奇怪了，我的怎么登陆不进去呢？
		// 第一步，创建一个webbook，对应一个Excel文件
				HSSFWorkbook wb = new HSSFWorkbook();
				// 第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
				HSSFSheet sheet = wb.createSheet("赞赞民生人统计表");
				sheet.setDefaultColumnWidth(20);
				// 第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
				HSSFRow row = sheet.createRow((int) 0);
				// 第四步，创建单元格，并设置值表头 设置表头居中
				HSSFCellStyle style = wb.createCellStyle();
				style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
				
				HSSFCell cell = row.createCell(0);
				cell.setCellValue("部门及科室");
				cell.setCellStyle(style);
				cell = row.createCell(1);
				cell.setCellValue("工号");
				cell.setCellStyle(style);
				cell = row.createCell(2);
				cell.setCellValue("姓名");
				cell.setCellStyle(style);
				cell = row.createCell(3);
				cell.setCellValue("工作内容");
				cell.setCellStyle(style);
				cell = row.createCell(4);
				cell.setCellValue("是否填写");
				cell.setCellStyle(style);
				cell = row.createCell(5);
				cell.setCellValue("创建时间");
				cell.setCellStyle(style);
				cell = row.createCell(6);
				cell.setCellValue("审阅状态"); 
				cell.setCellStyle(style);
				cell = row.createCell(7);
				cell.setCellValue("审阅情况"); 
				cell.setCellStyle(style);
				cell = row.createCell(8);
				cell.setCellValue("审批情况"); 
				cell.setCellStyle(style);
				cell = row.createCell(9);
				cell.setCellValue("审批详情：审批人"); 
				cell.setCellStyle(style);
				cell = row.createCell(10);
				cell.setCellValue("审批内容"); 
				cell.setCellStyle(style);
				cell = row.createCell(11);
				cell.setCellValue("审阅时间"); 
				cell.setCellStyle(style);
				cell = row.createCell(12);
				cell.setCellValue("审批人"); 
				cell.setCellStyle(style);
				cell = row.createCell(13);
				cell.setCellValue("审批内容"); 
				cell.setCellStyle(style);
				cell = row.createCell(14);
				cell.setCellValue("审阅时间"); 
				cell.setCellStyle(style);
				// 第五步，写入实体数据 实际应用中这些数据从数据库得到，
				for (int i = 0; i < userList.size(); i++)
				{
					row = sheet.createRow((int) i + 1);
					EmpWorkCon workLog =  userList.get(i);
					// 第四步，创建单元格，并设置值
					String iswright ="";
					if(workLog.getWorkCon()!=null&&!workLog.getWorkCon().equals("")){
						iswright ="√";
					}
					row.createCell(0).setCellValue(workLog.getWorkDeptName());
					row.createCell(1).setCellValue(workLog.getWorkEmpId());
					row.createCell(2).setCellValue(workLog.getWorkEmpName());
					row.createCell(3).setCellValue(workLog.getWorkCon());
					row.createCell(4).setCellValue(iswright);
					row.createCell(5).setCellValue(workLog.getWorkCreateTime());
					row.createCell(6).setCellValue(workLog.getWorkReviewState());
					String[] empids = workLog.getWorkReviewEmpIdAll().split(";");
					if(empids.length==1){
						row.createCell(7).setCellValue(empids[0]);
						row.createCell(8).setCellValue("");
					}else if(empids.length==2){
						row.createCell(7).setCellValue(empids[0]);
						row.createCell(8).setCellValue(empids[1]);
					}else{
						row.createCell(7).setCellValue("");
						row.createCell(8).setCellValue("");
					}
					
					List<WorkConReview> reviews = workLog.getReviews();
					int z=1;
					for(int j=0;j<reviews.size();j++){
						WorkConReview wr = reviews.get(j);
						row.createCell(8+z).setCellValue(wr.getReEmpName());
						z++;
						row.createCell(8+z).setCellValue(wr.getReComCon());
						z++;
						row.createCell(8+z).setCellValue(wr.getReCreateTime());
						z++;
					}
				}
				// 第六步，将文件存到指定位置
				try
				{
					wb.write(out);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			
		
	}
	
	
}
